<link href="<?php echo base_url("public/template/backend/css/ui-lightness/jquery-ui-1.10.4.min.css") ?>" rel="stylesheet" type="text/css"/>
<?php 
            $re = "/add/";
$str = uri_string();
if (preg_match($re, $str)) {
    $sub = TRUE;
} else {
    $sub = FALSE;
}
?>
<div class="title-menu">
    <h2><?php if($sub==TRUE) echo "Thêm quảng cáo"; else echo "Sửa quảng cáo";?></h2>
</div>
<nav class="bonus">
    <a href="<?php echo base_url("backend/ads");?>"><< Quay lại</a>
</nav>
<article>
    <form method="post" action="" enctype="multipart/form-data">
        <fieldset>
            <ul class="error">
                <?php echo validation_errors(); ?>
                <?php echo isset($error)?$error:'';?>
            </ul>            
                  
            <p>
                <label>Hình ảnh:</label>
                <?php if (isset($pro->img)) { ?>
                <img src="<?php echo base_url($pro->img); ?>" width="100" alt="No Image"/>
            <?php } ?>
                <input type="file" name="img"/>
            </p>
            <p>
                <label>Đường dẫn:</label>
                <input type="text" name="data[url]" value="<?php if(isset($pro->url)) echo $pro->url; else echo set_value('data[url]');?>"/>
            </p>
            <script>
                    $(function() {
                        $(".datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
                    });
            </script>
            <p>
                <label>Ngày bắt đầu: </label>
                <input type="text" name="data[date_start]" class="datepicker" value="<?php if(isset($pro->date_start)) echo $pro->date_start; else echo set_value('data[date_start]'); ?>"/>
            </p>
            <p>
                <label>Ngày kết thúc: </label>
                <input type="text" name="data[date_end]" class="datepicker" value="<?php if(isset($pro->date_end)) echo $pro->date_end; else echo set_value('data[date_end]'); ?>"/>
            </p>
            
            
            <p>
                <label></label>
                <input type="submit" name="add" value="<?php if($sub == TRUE)echo "Thêm"; else echo "Sửa";?>"/>
            </p>
        </fieldset>
    </form>
</article>